<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<div id="dlg" style="">
  <form id="formChangePassword" action="${pageContext.request.contextPath}/auth/change-password" style="width: 400px;margin: auto;">
  	<div style="clear: both;height: 30px"></div>
  	<label>Mật khẩu:</label><input type="password" name="mypassword" />
  	<div style="clear: both;height: 3px"></div>
  	<label>Mật khẩu mới:</label><input type="password" name="newpassword" />
  	<div style="clear: both;height: 3px"></div>
  	<label>Nhập lại mật khẩu mới:</label><input type="password" name="configpassword" />
  	<div style="clear: both;height: 3px"></div>
  	<label></label><input type="submit" value="Lưu"/>              
      <p class="change-pass-err" style="color: red"></p>
    </form>
</div>
 <script type="text/javascript">
	$("#formChangePassword").submit(function(e) {		
         	var postData = $(this).serializeArray();
         	var formURL = $(this).attr("action");
         	$.ajax({
         		url : formURL,
         		type : "POST",
         		data : postData,
         		success : function(data, textStatus, jqXHR) {
         			if(data == 'ok'){
         				alert('Mật khẩu được đã thay đổi');
         				$('input[type=password]').val('');
         				$('#dlg').dialog('close');
         			}else{
         				$('.change-pass-err').html(data);          				
         			}
         		},
         		error : function(jqXHR, textStatus, errorThrown) {}
         	});
         	e.preventDefault();
         	
        });		
</script>